package com.mentaleye.dal.dao.mybatis;

import com.mentaleye.dal.dao.GroupDao;
import com.mentaleye.dal.model.Group;
import com.mentaleye.dal.model.GroupExample;
import com.mentaleye.dal.service.GroupMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Rock on 2017/5/8.
 */

@Repository
public class GroupDaoImpl extends BaseDao implements GroupDao{

    @Autowired private GroupMapper groupMapper;

    public boolean insert(Group group){
       return getResultByInt(groupMapper.insertSelective(group));
    }

    public boolean update(Group group){
        return getResultByInt(groupMapper.updateByPrimaryKeySelective(group));
    }

    public boolean delete(Integer groupId){
        return getResultByInt(groupMapper.deleteByPrimaryKey(groupId));
    }

    public boolean deleteByExample(GroupExample example){
        return getResultByInt(groupMapper.deleteByExample(example));
    }

    public Group select(Integer groupId){
        return groupMapper.selectByPrimaryKey(groupId);
    }

    public List<Group> selectByExample(GroupExample example){
        return groupMapper.selectByExample(example);
    }
}
